import { RequestHandler } from 'express';
import { res_send_cur_info_is_create } from '../Classes/cla_res_send_cur_info_is_create';
import { check_identity_or_phone_is_created } from '../Func/check_identity_or_phone_is_created';

/**
 * 检测 身份证卡号 和 手机号 是否 已注册
 */
export const post_allocate_id: RequestHandler = async (req, res) => {
  let { Identity_card_number, phone } = req.body;

  let is_created = await check_identity_or_phone_is_created(
    { Identity_card_number, phone },
    res
  );

  // 身份证卡号 电话号码 已 注册过
  if (is_created) {
    return;
  }

  // 未被 注册
  let cur_info_is_not_create = new res_send_cur_info_is_create();

  res.send(cur_info_is_not_create);
  return;
};
